import { Injectable } from '@nestjs/common';
import { Repository } from 'typeorm';
import { InjectRepository } from '@nestjs/typeorm';
import { Dic } from '@/entity/dic/dic.entity';

@Injectable()
export class DicService {
  constructor(
    @InjectRepository(Dic)
    private dicRepository: Repository<Dic>,
  ) {}

  async insert(postParams: any): Promise<any> {
    return this.dicRepository.save(postParams);
  }

  async findDic(dic_type: string): Promise<any> {
    return this.dicRepository.find({ where: { dic_type } });
  }

  async findAll(): Promise<any>{
    return this.dicRepository.find();
  }
}
